package com.demo.main;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import com.demo.server.AIOTimeServer;
import com.demo.server.ChatServerEnhanceFactory;
import com.demo.server.ChatServerFactory;
import com.demo.server.IServer;
import com.demo.server.NIOChatServerFactory;
import com.demo.util.Prop;

public class Main {

	private final static Log LOG = LogFactory.getLog(Main.class);
	private static int port;
	static {
		port = Integer.parseInt(Prop.getConf().getProperty("SERVERPORT", Prop.DEFAULT_PORT));
	}

	public static void main(String[] args) {
		IServer server;
		// server = new ChatServerFactory().getServer(port);
		// server = new ChatServerEnhanceFactory().getServer(port);
		// server = new NIOChatServerFactory().getServer(port);
		server = new AIOTimeServer();
		try {
			server.bootStrap();
		} catch (Exception e) {
			LOG.error(e);
			server.shutDown();
			e.printStackTrace();
		}
	}
}
